package top.market.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author li yuhai
 * @since 2025-03-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("orders")
public class Orders implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 订单号
     */
    @TableField("number")
    private String number;

    /**
     * 订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消 7退款
     */
    @TableField("status")
    private Integer status;

    /**
     * 下单用户
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 地址id
     */
    @TableField("address_book_id")
    private Long addressBookId;

    /**
     * 下单时间
     */
    @TableField("order_time")
    private LocalDateTime orderTime;

    /**
     * 结账时间
     */
    @TableField("checkout_time")
    private LocalDateTime checkoutTime;

    /**
     * 预计送达时间
     */
    @TableField("estimated_delivery_time")
    private LocalDateTime estimatedDeliveryTime;

    /**
     * 支付方式 1微信,2支付宝
     */
    @TableField("pay_method")
    private Integer payMethod;

    /**
     * 支付状态 0未支付 1已支付 2退款
     */
    @TableField("pay_status")
    private Integer payStatus;

    /**
     * 实收金额
     */
    @TableField("amount")
    private BigDecimal amount;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 手机号
     */
    @TableField("phone")
    private String phone;

    /**
     * 地址
     */
    @TableField("address")
    private String address;

    /**
     * 收货人
     */
    @TableField("consignee")
    private String consignee;

    /**
     * 订单取消原因
     */
    @TableField("cancel_reason")
    private String cancelReason;

    /**
     * 订单拒绝原因
     */
    @TableField("rejection_reason")
    private String rejectionReason;

    /**
     * 订单取消时间
     */
    @TableField("cancel_time")
    private LocalDateTime cancelTime;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;


    public static final String ID = "id";

    public static final String NUMBER = "number";

    public static final String STATUS = "status";

    public static final String USER_ID = "user_id";

    public static final String ADDRESS_BOOK_ID = "address_book_id";

    public static final String ORDER_TIME = "order_time";

    public static final String CHECKOUT_TIME = "checkout_time";

    public static final String ESTIMATED_DELIVERY_TIME = "estimated_delivery_time";

    public static final String PAY_METHOD = "pay_method";

    public static final String PAY_STATUS = "pay_status";

    public static final String AMOUNT = "amount";

    public static final String REMARK = "remark";

    public static final String PHONE = "phone";

    public static final String ADDRESS = "address";

    public static final String CONSIGNEE = "consignee";

    public static final String CANCEL_REASON = "cancel_reason";

    public static final String REJECTION_REASON = "rejection_reason";

    public static final String CANCEL_TIME = "cancel_time";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

}
